﻿using System;
/*

    Write a program that reads 3 numbers:
    integer a (0 <= a <= 500)
    floating-point b
    floating-point c
    The program then prints them in 4 virtual columns on the console. Each column should have a width of 10 characters.
    The number a should be printed in hexadecimal, left aligned
    Then the number a should be printed in binary form, padded with zeroes
    The number b should be printed with 2 digits after the decimal point, right aligned
    The number c should be printed with 3 digits after the decimal point, left aligned.

 */
class FormattingNumbers
{
    static private void CheckFirstNumber(int fNumberA)
    {
        while ((fNumberA < 0) || (fNumberA > 500))
        {
            Console.WriteLine("First number MUST be > and > 500!");
            fNumberA = int.Parse(Console.ReadLine());
        }
    }
    private static void FormatTable(int fNumberA, double sNumberB, double tNumberC, string fNumberABinary)
    {
        Console.WriteLine(string.Format("{0,-10} | {1,10} | {2,10} | {3:X}|{4}|{5:F2}|{6:F3}", fNumberA, sNumberB, tNumberC, fNumberA, fNumberABinary, sNumberB, tNumberC));
    }
    static void Main()
    {
        int fNumberA;
        double sNumberB;
        double tNumberC;
        string fNumberABinary;
       
        Console.WriteLine("Enter all first Numbers(A`s), MUST be >0 and <500: ");
        fNumberA = int.Parse(Console.ReadLine());
        CheckFirstNumber(fNumberA);                     //checking (0 <= a <= 500)
        Console.WriteLine("Enter a second number: ");
        sNumberB = double.Parse(Console.ReadLine());
        Console.WriteLine("Enter a third number: ");
        tNumberC = double.Parse(Console.ReadLine());
        fNumberABinary = Convert.ToString(fNumberA, 2); //convert first nummber to binary

        Console.WriteLine();
        Console.WriteLine(new string('-', 60));                                             //chart
        Console.WriteLine("{0,-10} | {1,10} | {2,10} | {3,10}", "A", "B", "C", "result");   //header
        Console.WriteLine(new string('-', 60));

        FormatTable(fNumberA, sNumberB, tNumberC, fNumberABinary);  //chart formatting
        Console.WriteLine(new string('-', 60));
        Console.WriteLine();



    }

}
